package com.tj.bo.user.server.dao;

import com.fqgj.common.api.Page;
import com.fqgj.common.base.BaseMapper;
import com.tj.bo.user.server.entity.UserProductOddsEntity;
import com.tj.bo.user.server.entity.bussiness.UserHaveOddsEntity;

import java.util.Date;
import java.util.List;

/**
 * User: xulin
 * Date: 2020-07-31
 * Time: 17:26:00.382
 */

public interface UserProductOddsDao extends BaseMapper<UserProductOddsEntity> {

    List<UserProductOddsEntity> getByUserCodeAndProductCode(String userCode, String productCode, Integer triggerType);

    List<UserProductOddsEntity> getByUserProductList(String productCode);

    /**
     * 按时间查询有效的
     *
     * @param userCode
     * @param productCode
     * @param expireDate
     * @return
     */
    List<UserProductOddsEntity> selectUserProductOddsByExpireDate(String userCode, String productCode, Date expireDate);

    /**
     * 使超过expireDate的记录失效
     *
     * @param userCode
     * @param productCode
     * @param expireDate
     * @return
     */
    int invalidateUserProductOdds(String userCode, String productCode, Date expireDate);

    /**
     * 查询存在pl变动过的用户
     *
     * @param page
     * @return
     */
    List<UserHaveOddsEntity> selectUserHaveOddsList(Date expireDate, Page page);

}